import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
//        写一个递归方法，输入一个非负整数，返回组成它的数字之和
        Scanner scanner = new Scanner(System.in);
        int x = scanner.nextInt();
        System.out.println(sum(x));
        }
    public static int sum(int x) {
        if (x / 10 == 0) return x;
        return x%10 + sum(x/10);
    }
}